Ext.namespace("Ext.milan.pagejs.page_pubDqgz");
Ext.milan.pagejs.page_pubDqgz.userWin = null;
Ext.milan.pagejs.page_pubDqgz.subWin = null;
Ext.milan.pagejs.page_pubDqgz.REQUEST_ACTION = "pubDqgz";
var selectPostionTree = null;
Ext.milan.pagejs.page_pubDqgz.docLoadBeforeCallBack = function() {
};

Ext.milan.pagejs.page_pubDqgz.docOnReadyCallback = function() {

};

Ext.milan.pagejs.page_pubDqgz.changeJl = function(zt){
	var lbContaniner = $("lb");
	if(zt != ""){
		Milan.ajax.request( {
			url : "pubData/getSubList.do?pid=" + zt.value,
			success : function(response, option) {
				lbContaniner.innerHTML = "";
				var oOption = new Option('请选择','');
				lbContaniner.options.add(oOption);
				if(response&&response.responseText){
					var data = eval("("+response.responseText+")");
					var res = data.root;
					for(var i=0;i<res.length;i++){
						var oOption = new Option(res[i].name,res[i].id);
						lbContaniner.options.add(oOption);
					}
				}
			},
			method : "POST"
		});
	}else{
		cplbContaniner.innerHTML = "";
		var oOption = new Option('请选择','');
		cplbContaniner.options.add(oOption);
	}
};


/**
 * 关闭子弹出窗口
 */
Ext.milan.pagejs.page_pubDqgz.closeSubWin = function() {
	Milan.commonutils.closeModelPop(Ext.milan.pagejs.page_pubDqgz.subWin);
};

/**
 * 关闭弹出窗口
 */
Ext.milan.pagejs.page_pubDqgz.closeWin = function(winName) {
	if(winName){
		if(winName=='inactivateConsignerWin')
			inactivateConsignerWin.closeDialog();
	}
	else
		Milan.commonutils.closeModelPop(Ext.milan.pagejs.page_pubDqgz.userWin);
};

/*------------------------ private methods -----------------------*/

/**
 * 查询所有
 */
Ext.milan.pagejs.page_pubDqgz._search = function() {
	Ext.milan.pagejs.common_utils.query(false, "pubDqgz/list.do");
};

Ext.milan.pagejs.page_pubDqgz._formCheck = function(frm) {
	function focusElement(el) {
		if(el.focus)
			el.focus();
	};
	return true;
};

/**
 * 保存信息
 */
Ext.milan.pagejs.page_pubDqgz._saveInfo = function(formId) {
	if(!Ext.milan.pagejs.page_pubDqgz._formCheck($(formId)))
		return;
		
	Milan.ajaxutility.formSubmit({
		form:formId,
		success:function(response)
		{
			Ext.milan.pagejs.page_pubDqgz.closeWin();
			Ext.milan.pagejs.page_pubDqgz.query();
		}
	});
};

/**
 * 条件查询列表
 */
Ext.milan.pagejs.page_pubDqgz.query = function() {
	Milan.pagejs.page_index.updateCurrentTabByForm("query_pubDqgz_list_form");
};

/**
 * 显示新建表单
 */
Ext.milan.pagejs.page_pubDqgz.showAddForm = function() {
	var url = Ext.milan.pagejs.page_pubDqgz.REQUEST_ACTION + "/create.do";
	Ext.milan.pagejs.page_pubDqgz.userWin = Milan.commonutils.createModelPop({
		title:"新建", 
		url:url,
		width:850
	});
};

/**
 * 显示编辑表单
 * 
 * @param ID
 */
Ext.milan.pagejs.page_pubDqgz.showEditForm = function(id) {
	var url = Ext.milan.pagejs.page_pubDqgz.REQUEST_ACTION + "/edit.do?id=" + id;
	Ext.milan.pagejs.page_pubDqgz.userWin = Milan.commonutils.createModelPop({
		title:"编辑",
		url:url,
		width:850
	});
};

/**
 * 保存新建用户信息
 */
Ext.milan.pagejs.page_pubDqgz.save = function(formId) {
	Ext.milan.pagejs.page_pubDqgz._saveInfo(formId);
};

/**
 * 保存编辑后的信息
 */
Ext.milan.pagejs.page_pubDqgz.edit = function(formId) {
	Ext.milan.pagejs.page_pubDqgz._saveInfo(formId);
};

Ext.milan.pagejs.page_pubDqgz.deleteForm = function(id) {
	var url = Ext.milan.pagejs.page_pubDqgz.REQUEST_ACTION + "/delete.do?id=" + id;
	new Milan.widget.ConfirmDialog("确认信息", "确认要删除该信息吗？", {
		confirmCallback: function() {
			Milan.ajaxutility.formSubmit({
				url: url,
				method: 'post',
				success: function(response, option)
				{
					Ext.milan.pagejs.page_pubDqgz.query();
				}
			});
		}
	});	
};

/**
 * 查看详情
 * 
 * @param entityId 用户ID
 */
Ext.milan.pagejs.page_pubDqgz.viewDetail = function(entityId) {
	var url = Ext.milan.pagejs.page_pubDqgz.REQUEST_ACTION + "/show.do?id=" + entityId;
	Ext.milan.pagejs.page_pubDqgz.userWin = Milan.commonutils.createModelPop({
		title:"详细信息",
		url:url,
		width:850
	});
};